Skip to content

Make grids create fewer hidden image objects - #25

Merged
tannewt merged 2 commits into
tannewt:lvgl_displayiofrom
mikeysklar:lvgl-tilegrid-views
Nov 16, 2026
Merged

tannewt merged 2 commits into
tannewt:lvgl_displayiofrom
mikeysklar:lvgl-tilegrid-views

Conversation

@mikeysklar

Copy link
Copy Markdown

What

Create TileGrid views only when needed, and set the pivot only when scaled.

Why

Each pivot call ran a full-screen layout, four times per composed grid.

homeview slider drag, per 13.5 s phase Before After
Time in TileGrid refresh 3.7 s 0.25 s
Redraws per second 9.5-11.3 12.2-12.6

An unscrolled grid needs one view; a scrolled one needs up to four.

A second commit keeps the retry flag set when a view can't be allocated, found by reading.

All four PRs together, homeview, 8 rounds lvgl_displayio With PRs
Slider drag, redraws per second 6.3-11.0 48.4-51.0
Slider step, median handler time 1.3-2.6 s 114-118 ms
Python waiting on the LVGL lock 9.1-11.1 s 0-0.05 s
Tab and swipe redraws per second 18.0-34.4 19.3-38.1
Display underruns 0 0
Tested
Board Metro ESP32-P4, Raspberry Pi Touch Display 2
Build 11.0.0-alpha.3 on lvgl_displayio, bench profiler, 4 rounds

AI assistance

Claude Code wrote this change and ran the tests above. I reviewed the diff and tested homeview by hand on the board.

🤖 Generated with Claude Code

mikeysklar and others added 2 commits November 14, 2026 09:01
Every composed TileGrid created all four of its views, and each new
view set its pivot. LVGL lays out the whole screen before it moves a
pivot, so attaching one grid cost about four full layout passes. An
unscrolled grid only needs one view, and the pivot only matters once
the view is scaled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_layout_views() leaves lv_views_dirty set when it can't create a view, so
the next refresh tries again. _refresh() cleared the flag right after, so
the grid stayed without its views until something else marked them dirty.
_layout_views() already clears the flag when it starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@tannewt tannewt left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit 2c8d6b3 into tannewt:lvgl_displayio Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants